<?php
/**
 * 系統名稱: Lotto 系統
 * 檔案說明: 專案管理-修改
 * $Author$
 * $Id$
 * $Log$
 *
 */
set_time_limit(0);
include_once("../config.inc.php");

session_start();
include(__Language_Path."/selectlanguage_admin.php");
include(__Common_Path."/AllWeb.inc.php");

$arrPower = CheckUsePower("getallreport");
if($arrPower === false || $arrPower[1] == "")ErrMsgOutputHTML("Error", "", 1);
$arrP1 = explode("@", $arrPower[1]);
$arrP2 = explode("#", $arrP1[1]);

if(empty($_data["GameDate"]))$_data["GameDate"] = date("Y-m-d");
if(empty($_data["GameTime1"]))$_data["GameTime1"] = "00:00:00";
if(empty($_data["GameTime2"]))$_data["GameTime2"] = "24:00:00";
$arrWeb = array();
if(sizeof($arrP2) > 0){
	foreach($_arrWeb as $key => $arrV){
		if(!in_array((int)$arrV[2], $arrP2))continue;
		$arrWeb[] = $arrV[0];
	}
}
//$arrCon = file("http://secure.luckyball.cc/crontab/getReport.php?GameDate=".$_data["GameDate"]."&AllWeb=".join(",", $arrWeb));

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://192.168.5.20/crontab/getReport.php");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POST, 1); 
curl_setopt($ch, CURLOPT_POSTFIELDS, "GameDate=".$_data["GameDate"]."&GameTime1=".$_data["GameTime1"]."&GameTime2=".$_data["GameTime2"]."&AllWeb=".join(",", $arrWeb));
//print "GameDate=".$_data["GameDate"]."&GameTime1=".$_data["GameTime1"]."&GameTime2=".$_data["GameTime2"]."&AllWeb=".join(",", $arrWeb);
$ret = curl_exec ($ch);
curl_close ($ch);

foreach($_arrWeb as $key => $arrV){
	$ret = str_replace("{".$arrV[0]."}", $arrV[1], $ret);
}
?>
<form action="<?php print $_SERVER["PHP_SELF"];?>" name="ReportFrm">
報表日期：<input type="text" name="GameDate" value="<?php print $_data["GameDate"];?>" size="10"><br />
下注時間：<input type="text" name="GameTime1" value="<?php print $_data["GameTime1"];?>" size="10">~
<input type="text" name="GameTime2" value="<?php print $_data["GameTime2"];?>" size="10">
<input type="button" value="更新" onclick="document.ReportFrm.submit()">
</form>
<?php
print $ret;
?>